#ifndef CHARACTER_HH
#define CHARACTER_HH

#include <string>
#include <vector>
#include "Item.hh"
#include "ICharacter.hh"

//This header file defines a Character class that inherits from an ICharacter interface. It models a character with attributes like name, description, health, attack power, defense, and money. Key functionalities include:

//Attributes:
//Name, description, health (current and max), attack power, defense, and money.
//An inventory (std::vector<Item*>) to store items.
//Methods:
//Status Checks: isAlive(), takeDamage(unsigned damage).
//Combat: attack(ICharacter& target).
//Getters: For name, description, health, attack, defense, and money.
//Inventory Management: addToInventory(Item* item), displayInventory().
//Display: toString(), display() for representing the character.
//Money Comparisons: Overloaded operators (>=, <=, ==) for comparing money values.
//Destructor: Virtual destructor for proper cleanup.
//This class is designed for RPG-style systems, managing character stats, combat, and inventory.

class Character : public ICharacter { 
public:
    Character(std::string name, std::string desc, unsigned health, unsigned maxhealth, unsigned attack, unsigned defense,unsigned money);
    virtual ~Character();

    bool isAlive() const override;
    bool takeDamage(unsigned damage) override;
    bool attack(ICharacter& target) override;

    std::string getName() const override { return name; }
    std::string getDescription() const override { return description; }
    unsigned getmaxHealth() const override { return maxHealth; }
    unsigned getHealth() const override { return health; }
    unsigned getAttack() const override { return attacks; }
    unsigned getDefense() const override { return defense; }
    std::string toString() const override;

    void addToInventory(Item* item) override;
    void displayInventory() const override;
    void display() const override;
    bool operator>=(int moneyValue) const {return money >= static_cast<unsigned>(moneyValue);}
    bool operator<=(int moneyValue) const {return money <= static_cast<unsigned>(moneyValue);}
    bool operator==(int moneyValue) const {return money == static_cast<unsigned>(moneyValue);}
    int getMoney() const { return money; }
    void setMoney(int m) { money = m; }
    std::vector<Item*> inventory;
    
protected:
    std::string name;
    std::string description;
    unsigned health;
    unsigned maxHealth;
    unsigned attacks;
    unsigned defense;
    
    unsigned money;
};

#endif